package com.kaifamiao.ioc.creation;

import java.util.Random;

public class CarFactory {

    private final String[] brands = { "秦" , "汉" , "唐" , "宋" ,  "元" , "明"  } ;
    private final Random rand = new Random();

    public Car produce() {
        Car c = new Car();
        int index = rand.nextInt( brands.length ) ;
        String b = brands[ index ] ;
        c.setBrand(  b );
        return c ;
    }

}
